/**

 */

var pageXHR;
var feedId;

var pageUrl = "http://www.netflix.com/RSSFeeds?lnkctr=mfRSS";

function handlePageResult(doc)
{
	var fixURL1 = doc.split('?id=');
	var fixURL2 = fixURL1[1].split('\">');
	feedId = fixURL2[0];
	
	var dctk = connected.toolkit;
	connected.debug.print("feedId= "+feedId);
	
	feed="http://rss.netflix.com/QueueEDRSS?id="+feedId; 
	onLoadComplete();
	
}

function startPageRequest()
{
    pageXHR = new XMLHttpRequest();
    pageXHR.onreadystatechange = onPageXHRStateChange;
    pageXHR.open("GET", pageUrl, true);
	pageXHR.overrideMimeType('text/xml');
    pageXHR.send(null);
}

function onPageXHRStateChange()
{
    if (pageXHR.readyState == 4)
    {
        if (pageXHR.status == 200)
        {
            //findMedia(pageXHR.responseXML);
			handlePageResult(pageXHR.responseText);
        }
    }
}